<? 
/*

@class 		form_element_listBox
@author		Jelle Versele
@email		me@jelleversele.be

stelt een listbox object voor 

*/

require_once('form/element.class.php');

class form_element_listBox extends form_element{
	
	/*
	instantie maken 
	hier wordt het html select object aangemaakt 
	@param	string
	*/
	public function __construct($iName){
		$this -> members = array();
	
		parent::__construct($iName);
		
		$this -> html = new view_htmlTag('select');
		$this -> html -> setAttribute('name', $iName);
		$this -> html -> setAttribute('id', $iName);
	}	
		
	/*
	@method		childs worden rechtstereeks in het select object geimporteerd
	*/
	public function add($iDisplay, $iValue){
		
		$child = new view_htmlTag('option');
		$child -> setAttribute('value', $iValue);
		$child -> setText($iDisplay);
		
		$this -> html -> addChild($child);
	
	}
	
	public function setValue($iValue){
	
		foreach($this -> html -> getChilds() as $child){
		
			if($child -> getAttribute('value') == $iValue){
			
				$child -> setAttribute('selected', 'selected');
			
			}
		
		}
	
	}
	


}

?>